#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int x,n,y;
	while(cin>>x>>n)
	{
		int substract;
		if(!x && !n)
			break;
		int end=ceil(pow(x,1.0/n));
		substract=abs(pow(end-1,n)-x);
		if(substract>abs(pow(end,n)-x))
			y=end;
		else
			y=end-1;
		cout<<y<<endl;
	}
    return 0;
}
